
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"/>
    <title>南湖云量化</title>
    <link rel="stylesheet" href="/static/UPQuant/css/reset.css">
	<link rel="stylesheet" href="/static/UPQuant/css/index.css">
    <link rel="stylesheet" href="//static.360buyimg.com/finance/base/1.2.0/css/base.css"/>
    <link rel="stylesheet" href="//static.360buyimg.com/finance/platform/quantification/1.0.0/css/index.css"/>
    <link rel="stylesheet" href="//static.360buyimg.com/finance/platform/quantification/1.0.0/css/edit.css"/>
    <link rel="stylesheet" href="/static/UPQuant/js/datapicker/css/pikaday.css">
    <link rel='stylesheet' href='/static/UPQuant/js/nprogress-master/nprogress.css' />
    <style type="text/css" media="screen">
        #sourceCode {
            position: absolute;
            height: 770px;
            width: 100%;
            margin: 0 0 0 0;
        }
    </style>
</head>
<body>
<div class="header">
    <div class="header_main">
        <img src="/static/UPQuant/images/logo.png"  class="logo">
        <div class="nav">
            <ul>
                <li><a href="#">首页</a></li>
                <li><a href="#">云数据</a></li>
                <li class="on"><a href="#">云策略</a></li>
                <li><a href="#">云交易</a></li>
                <li><a href="#">云资管</a></li>
            </ul>
        </div>
    </div>
</div>
<div class="eidit-container">
    <div class="eidit-con-title clearfix">
        <div class="eidit-main">
            <ul class="result-list clearfix">
                <li class="add-li-col">
                    <a href="#" class="state">编辑策略</a>
                </li>
                <li>
                    <a href="#" class="state">回测结果</a>
                </li>
                <li>
                    <a href="#" class="state state-end">回测历史</a>
                </li>
            </ul>
        </div>
        <div class="new-eidit clearfix">
            <a href="" class="left-return"></a>
            <input type="text" id="strategyName" maxlength="35" class="eidit-text" value="新建策略2016-08-22 19:57:10"/>
        </div>
    </div>
    <div class="edit-container clearfix">
        <div id="j_leftCon" class="edit-container-leftbar">
            <form id = "source_code" method="post">
                <div class="edit-left-con clearfix">
                    <div class="error-tishi" id="editMessage" style="display: none"></div>
                    <div class="write-eidit">
                        <input id=‘put‘ type="submit" value = "编译" class="bianyi"/>
                    </div>
                </div>
            </form>
            <pre id="sourceCode"># 可以自己import我们平台支持的第三方python模块，比如pandas、numpy等。

# 在这个方法中编写任何的初始化逻辑。context对象将会在你的算法策略的任何方法之间做传递。
def init(context):
    context.s1 = "000001.XSHE"
    # 是否已发送了order
    context.fired = False

# 你选择的证券的数据更新将会触发此段逻辑，例如日或分钟历史数据切片或者是实时数据切片更新
def handle_bar(context, bar_dict):
    # 开始编写你的主要的算法逻辑

    # bar_dict[order_book_id] 可以拿到某个证券的bar信息
    # context.portfolio 可以拿到现在的投资组合状态信息

    # 使用order_shares(id_or_ins, amount)方法进行落单

    # TODO: 开始编写你的算法吧！
    if not context.fired:
        # order_percent并且传入1代表买入该股票并且使其占有投资组合的100%
        order_percent(context.s1, 1)
        context.fired = True</pre>
            <div id="j_sidebar" class="edit-left-sidebar"></div>
            <div class="state-wrap4" style="display: none">
                <div class="state4"></div>
                <div class="state4-close"></div>
            </div>
        </div>
        <form id = "run_code" method="post">
            <div class="edit-container-rightbar">
                <div class="edit-right-con clearfix">
                    <div class="edi-wraps">
                        <input id="datepicker_begin" name="startDate" class="date" readOnly="readOnly"
                               type="text" value="2015-01-01"/>
                        <span class="text">至</span>
                        <input id="datepicker_end" name="endDate" readOnly="readOnly" class="zhi-dates" type="text"
                               value="2016-01-01"/>
                        <div class="dollar">
                        <span class="do-icon">￥</span>
                        <input name="principal" id="principal" type="number" step="1000" class="jine" value="1000000"
                               maxlength="16"/>
                        </div>
                        <input id='run_code_btn' type="submit" value = "运行回测" class="renturn-back"/>
                        <div class="b-jin">
                            <span class="b-jin-text">编译中...</span>
                            <span class="b-du">
                                <span id="compileBar" class="b-j-du" style="width:0%"></span>
                            </span>
                            <span id="compileValue" class="num-bi">0%</span>
                            <a href="javascript:void(0);" onclick="strategy.cancelTest()" class="close-bian">取消编译</a>
                        </div>
                    </div>
                </div>
                <div class="bianji-con">
                    <ul class="bili-list clearfix">
                        <li class="clearfix">
                            <p class="bili-text">回测收益</p>
                            <div class="bl-du">
                                <span id="hcsy" class="bl-num">--</span>
                            </div>
                        </li>
                        <li class="clearfix">
                            <p class="bili-text">回测年化收益</p>
                            <div class="bl-du">
                                <span id="hcnhsy" class="bl-num">--</span>
                            </div>
                        </li>
                        <li class="clearfix">
                            <p class="bili-text">基准收益</p>
                            <div class="bl-du">
                                <span id="jzsy" class="bl-num col-bur-font">--</span>
                            </div>
                        </li>
                    </ul>
                    <div style="width: 100%; height: 85%" id="backTestChart">
                        <h2 style="height: 185px; line-height:185px; font-size: 20px; text-align: center;">请运行回测您的策略</h2>
                    </div>
                </div>
                <div class="journal">
                     <ul class="journal-list clearfix">
                    <li id="logTab" class="add-border-li">日志</li>
                    <li id="errorTab" class="">运行时错误</li>
                    </ul>
                    <div class="journal-detal">
                        <div id="logarea" style="height: 370px" class="change-box chang-show">
                        </div>
                        <div id="errorarea" style="height: 370px" class="change-box">
                        </div>
                    </div>
                </div>
                <div class="state-wrap5">
                    <div class="state5"></div>
                    <div class="state5-close"></div>
                </div>
                <div class="state-wrap6">
                    <div class="state6"></div>
                    <div class="state6-close"></div>
                </div>
            </div>
        </form>
    </div>
</div>



<script src="/static/UPQuant/js/ace/ace.js" type="text/javascript"></script>
<script src="/static/UPQuant/js/ace/ext-language_tools.js"></script>
<script src="/static/UPQuant/js/ace/ext-statusbar.js"></script>
<script src="/static/UPQuant/js/datapicker/moment.js"></script>
<script src="/static/UPQuant/js/datapicker/pikaday.js"></script>
<script src='/static/UPQuant/js/nprogress-master/nprogress.js'></script>
<script src="//static.360buyimg.com/finance/??common/lib/jquery/1.8.3/jquery.js"></script>
<script src="//static.360buyimg.com/finance/platform/quantification/1.0.0/js/eidit.js"></script>
<script src="/static/UPQuant/js/highchart/highstock.js"></script>
<script src="/static/UPQuant/js/highchart/exporting.js"></script
<script src="/static/UPQuant/js/highchart/HighChartsUtil-031e269ee7.min.js"></script>
<script src="/static/UPQuant/js/index.js"></script>
</body>
</html>